package com.example.administrator.printoutindemo;

import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.dds.soap.SoapListener;
import com.dds.soap.SoapParams;
import com.dds.soap.SoapUtil;
import com.example.administrator.printoutindemo.base.BaseActivity;
import com.example.administrator.printoutindemo.bean.UpdateMyAppBean;
import com.example.administrator.printoutindemo.http.SPUtil;
import com.example.administrator.printoutindemo.mvp.ui.activity.MainNengLiangEActivity;
import com.example.administrator.printoutindemo.mvp.ui.activity.PanDianActivity;
import com.example.administrator.printoutindemo.mvp.ui.activity.XunJianActivity;
import com.jess.arms.base.BaseConstants;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.DeviceUtils;
import com.vector.update_app.UpdateAppBean;
import com.vector.update_app.UpdateAppManager;
import com.vector.update_app.UpdateCallback;
import com.vector.update_app.listener.ExceptionHandler;
import com.vector.update_app.listener.IUpdateDialogFragmentListener;
import com.vector.update_app.utils.AppUpdateUtils;
import com.xiaoxing.zhinenghuacangku.mvp.ui.activity.MenuSelectionActivity;
import com.xiaoxing.zhinenghuacangku_jining.mvp.ui.activity.JiNing_MenuSelectionActivity;
import com.xiaoxing.zhinenghuacangku_liaocheng.mvp.ui.activity.LiaoCheng_MenuSelectionActivity;
import com.xiaoxing.zhinenghuacangku_linyi.mvp.ui.activity.LinYi_MenuSelectionActivity;
import com.xiaoxing.zhinenghuacangku_nanjinglu.mvp.ui.activity.NanJingLu_YiBanHeDianBiaoXuanZeActivity;
import com.xiaoxing.zhinenghuacangku_rizhao.mvp.ui.activity.RiZhao_MenuSelectionActivity;
import com.xiaoxing.zhinenghuacangku_zhijian.mvp.ui.activity.FengQianLieBiaoActivity;
import com.xiaoxing.zhinenghuacangku_zhijian.mvp.ui.activity.JianCeYuanGongNengXuanZeActivity;
import com.xiaoxing.zhinenghuacangku_zhijian.mvp.ui.activity.QuYangGongNengXuanZeActivity;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.ksoap2.SoapFault;
import org.ksoap2.serialization.SoapObject;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.jess.arms.utils.CProgressDialogUtils;
import me.jessyan.armscomponent.commonres.utils.ToolbarUtils;
import me.jessyan.armscomponent.commonres.utils.UpdateAppHttpUtil;
import me.jessyan.armscomponent.commonsdk.core.RouterHub;
import me.jessyan.armscomponent.commonsdk.utils.Utils;
import pub.devrel.easypermissions.EasyPermissions;

import static com.jess.arms.base.BaseConstants.NAME_SPACE;

/**
 * Created by Administrator on 2018/9/9.
 */
@Route(path = RouterHub.APP_LOGINACTIVITY)
public class LoginActivity extends BaseActivity implements EasyPermissions.PermissionCallbacks {
    public String name;
    SharedPreferences user;
    ImageView mBtnRight;
    private EditText edtUser, edtPwd;
    private Button login_btn_login, login_set;
    private TextView tv_version;
    private CheckBox cb_jzmm;
    private String mUpdateUrl = "https://raw.githubusercontent.com/WVector/AppUpdateDemo/master/json/json.txt";
    private String[] permissions = {android.Manifest.permission.CAMERA, android.Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION};

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.loginpage);

        ToolbarUtils.initToolbarTitleNoBack(this, "登录");
        mBtnRight = (ImageView) findViewById(R.id.btnRight);
        edtUser = (EditText) findViewById(R.id.login_edit_account);
        tv_version = (TextView) findViewById(R.id.tv_version);
        edtPwd = (EditText) findViewById(R.id.login_edit_pwd);
        login_btn_login = (Button) findViewById(R.id.login_btn_login);
        cb_jzmm = (CheckBox) findViewById(R.id.cb_jzmm);
        login_set = (Button) findViewById(R.id.login_set);
        user = getSharedPreferences("TEXT", Context.MODE_PRIVATE);
        login_set.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                toSettingPage();
            }
        });

        login_btn_login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (!getPermission()) return;

                if (TextUtils.isEmpty(user.getString(BaseConstants.PORT, "")) && TextUtils.isEmpty(user.getString(BaseConstants.IP, ""))) {

                    toSettingPage();

                    return;
                } else {


                    if (TextUtils.isEmpty(edtUser.getText().toString())) {
                        ArmsUtils.makeText(LoginActivity.this, "用户名不能为空");
                        return;
                    }
                    if (TextUtils.isEmpty(edtPwd.getText().toString())) {
                        ArmsUtils.makeText(LoginActivity.this, "密码不能为空");
                        return;
                    }
                    getUserInfoSoap();
                }

            }
        });
        boolean isRemember = user.getBoolean("user", false);
        if (isRemember) {
            String name = user.getString("name1", "");
            String password1 = user.getString("password1", "");
            edtUser.setText(name);
            edtPwd.setText(password1);
            cb_jzmm.setChecked(true);
        }


        tv_version.setText("当前版本：" + DeviceUtils.getVersionName(this));

        mBtnRight.setImageDrawable(getResources().getDrawable(R.drawable.icon_setting));
        mBtnRight.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                toSettingPage();
            }
        });
//        updateDiy(null);

//        constraintUpdate(null);
//        getVersionUpdateInfo();
    }

    private void toSettingPage() {
        Intent intent = new Intent(LoginActivity.this, SetActivity.class);
        startActivity(intent);
    }

    private boolean getPermission() {
        if (EasyPermissions.hasPermissions(this, permissions)) {
            return true;
        } else {
            EasyPermissions.requestPermissions(this, "需要获取您的照相使用权限", 103, permissions);
            return false;
        }

    }

    private void getUserInfoSoap() {

        showLoading();

        String methodName = "GetUserInfo";

        SoapParams params = new SoapParams();
        params.put("user_login", edtUser.getText().toString());
        params.put("user_pass", edtPwd.getText().toString());
        SPUtil.putString(LoginActivity.this, "namesss", edtUser.getText().toString());
        SPUtil.putString(LoginActivity.this, "pwdssss", edtPwd.getText().toString());

        /**
         * 请求
         */
        SoapUtil.getInstance(this).call(getUrl(), BaseConstants.NAME_SPACE, methodName, params, new SoapListener() {
            @Override
            public void onSuccess(int statusCode, SoapObject object) {
                hideLoading();


                String result = object.getProperty("GetUserInfoResult").toString();
                if (result != null && !result.equals("[]") && !result.equals("anyType{}")) {

                    try {
                        JSONArray jsonArray = new JSONArray(result);
                        for (int i = 0; i < jsonArray.length(); i++) {
                            JSONObject temp = (JSONObject) jsonArray.get(i);
                            String y = temp.getString("roles_id");
                            SPUtil.putString(LoginActivity.this, "iduser", temp.getString("user_id"));
                            SPUtil.putString(LoginActivity.this, "username", temp.getString("user_name"));
                            SPUtil.putString(LoginActivity.this, "roles_id", temp.getString("roles_id"));
                            SPUtil.putString(LoginActivity.this, "userlogin", temp.getString("user_login"));
                            String name = temp.getString("roles_name");
                            Log.e("name===", name);
                            SPUtil.putString(LoginActivity.this, "iduser", temp.getString("user_id"));
                            SPUtil.putString(LoginActivity.this, BaseConstants.API_USER_NAME, temp.getString("apiUserName"));
                            SPUtil.putString(LoginActivity.this, BaseConstants.API_PWD, temp.getString("apiPwd"));
                            // 仓管员的rolesId为2
                            if (name.equals(BaseConstants.LoginRole.CANG_GUAN_YUAN.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                String isauto = "";
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                    editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                    editor.putString(BaseConstants.USERNAME, temp.getString("user_name"));
                                    editor.putString(BaseConstants.MOBILE_PHONE, temp.getString("user_mobelPhone"));
                                    editor.putString(BaseConstants.COMPANY, temp.getString("user_company"));
                                    editor.putString(BaseConstants.ROLE_ID, "2");
                                    editor.putString(BaseConstants.ROLE_NAME, BaseConstants.LoginRole.CANG_GUAN_YUAN.getValue());

                                    editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                    editor.putString(BaseConstants.UID, temp.getString("user_id"));

                                    if (temp.has(BaseConstants.IS_AUTO)) {
                                        isauto = temp.getString(BaseConstants.IS_AUTO); //1 代表管理自动仓库 0 代表管理一般仓库
                                        String sid = temp.getString(BaseConstants.SID); //自动仓库的id
                                        editor.putString(BaseConstants.IS_AUTO, isauto);
                                        editor.putString(BaseConstants.SID, sid);
                                        editor.putString(BaseConstants.UID, temp.getString("user_id"));
                                    }

                                } else {
                                    editor.clear();
                                }
                                editor.commit();


                                if (isauto.equals("0") || TextUtils.isEmpty(isauto)) { //1 代表管理自动仓库 0 代表管理一般仓库

                                    toMainNengLiangEActivity();

                                } else {

                                    if (temp.getString("user_company").equals(BaseConstants.Company.COMPANY_LIN_YI.getValue())) {//判断是不是临沂的仓管员登录的
                                        //跳转到智能化仓库相关页面
                                        Intent intent = new Intent(LoginActivity.this, LinYi_MenuSelectionActivity.class);
                                        startActivity(intent);
                                    } else if (temp.getString("user_company").equals(BaseConstants.Company.COMPANY_QING_DAO.getValue())) {//判断是不是青岛的仓管员登录的
                                        //跳转到智能化仓库相关页面
                                        /**
                                         * @description 跳转到一般和电表功能选择页面 ,仓库功能分为一般操作和电表操作
                                         * @author: 小星
                                         * @UpdateDate: 2020/6/14 0014 16:33
                                         * @UpdateRemark: 更新说明： NanJingLu_MenuSelectionActivity 修改为NanJingLu_YiBanHeDianBiaoXuanZeActivity
                                         *
                                         */
                                        Intent intent = new Intent(LoginActivity.this, NanJingLu_YiBanHeDianBiaoXuanZeActivity.class);
                                        startActivity(intent);
                                    } else if (temp.getString("user_company").equals(BaseConstants.Company.COMPANY_LIAO_CHENG.getValue())) {//判断是不是聊城的仓管员登录的
                                        //跳转到智能化仓库相关页面
                                        Intent intent = new Intent(LoginActivity.this, LiaoCheng_MenuSelectionActivity.class);
                                        startActivity(intent);
                                    } else if (temp.getString("user_company").equals(BaseConstants.Company.COMPANY_RI_ZHAO.getValue())) {//判断是不是日照的仓管员登录的
                                        //跳转到智能化仓库相关页面
                                        Intent intent = new Intent(LoginActivity.this, RiZhao_MenuSelectionActivity.class);
                                        startActivity(intent);
                                    } else if (temp.getString("user_company").equals(BaseConstants.Company.COMPANY_JI_NING.getValue())) {//判断是不是济宁的仓管员登录的
                                        //跳转到智能化仓库相关页面
                                        Intent intent = new Intent(LoginActivity.this, JiNing_MenuSelectionActivity.class);
                                        startActivity(intent);
                                    } else {
                                        //跳转到智能化仓库相关页面
                                        Intent intent = new Intent(LoginActivity.this, MenuSelectionActivity.class);
                                        startActivity(intent);
                                    }

                                }
                                //TODO 登录成功后，结束掉登录页面，暂时注释掉
//                            finish();
                            }
                            // 物料员的rolesId为3,跳转到扫码页面
                            else if (name.equals(BaseConstants.LoginRole.WU_LIAO_YUAN.getValue()) || name.equals(BaseConstants.LoginRole.YING_JI_CHU_KU.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                    editor.putString(BaseConstants.USERNAME, temp.getString("user_name"));
                                    editor.putString(BaseConstants.MOBILE_PHONE, temp.getString("user_mobelPhone"));
                                    editor.putString(BaseConstants.COMPANY, temp.getString("user_company"));
                                    editor.putString(BaseConstants.ROLE_ID, "3");
                                    editor.putString(BaseConstants.ROLE_NAME, BaseConstants.LoginRole.CAI_LIAO_YUAN.getValue());
                                    editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                    editor.putString(BaseConstants.UID, temp.getString("user_id"));

                                } else {
                                    editor.clear();
                                }
                                editor.commit();
                                toMainNengLiangEActivity();

                            } else if (name.equals(BaseConstants.LoginRole.XUN_JIAN_YUAN.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                    editor.putString(BaseConstants.USERNAME, temp.getString("user_name"));
                                    editor.putString(BaseConstants.MOBILE_PHONE, temp.getString("user_mobelPhone"));
                                    editor.putString(BaseConstants.COMPANY, temp.getString("user_company"));
                                    editor.putString(BaseConstants.ROLE_ID, "3");
                                    editor.putString(BaseConstants.ROLE_NAME, BaseConstants.LoginRole.CAI_LIAO_YUAN.getValue());
                                    editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                    editor.putString(BaseConstants.UID, temp.getString("user_id"));
                                } else {
                                    editor.clear();
                                }
                                editor.commit();
                                Intent intent = new Intent(LoginActivity.this, XunJianActivity.class);
                                startActivity(intent);

                            }
                            // 审核人的rolesId为4,跳转到扫码页面
                            else if (name.equals(BaseConstants.LoginRole.SHEN_HE_REN1.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                    editor.putString(BaseConstants.USERNAME, temp.getString("user_name"));
                                    editor.putString(BaseConstants.MOBILE_PHONE, temp.getString("user_mobelPhone"));
                                    editor.putString(BaseConstants.COMPANY, temp.getString("user_company"));
                                    editor.putString(BaseConstants.ROLE_ID, "4");
                                    editor.putString(BaseConstants.ROLE_NAME, BaseConstants.LoginRole.SHEN_HE_REN.getValue());
                                    editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                    editor.putString(BaseConstants.UID, temp.getString("user_id"));
                                } else {
                                    editor.clear();
                                }
                                editor.commit();

                                toMainNengLiangEActivity();

                            }         // 聊城工器具角色
                            else if (name.equals(BaseConstants.LoginRole.GONG_QI_JU.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                    editor.putString(BaseConstants.USERNAME, temp.getString("user_name"));
                                    editor.putString(BaseConstants.MOBILE_PHONE, temp.getString("user_mobelPhone"));
                                    editor.putString(BaseConstants.COMPANY, temp.getString("user_company"));
                                    editor.putString(BaseConstants.ROLE_ID, "4");
                                    editor.putString(BaseConstants.ROLE_NAME, BaseConstants.LoginRole.GONG_QI_JU.getValue());
                                    editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                    editor.putString(BaseConstants.UID, temp.getString("user_id"));
                                } else {
                                    editor.clear();
                                }
                                editor.commit();

                                toMainNengLiangEActivity();

                            }
                            //领导
                            else if (name.equals(BaseConstants.LoginRole.LING_DAO.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                    editor.putString(BaseConstants.USERNAME, temp.getString("user_name"));
                                    editor.putString(BaseConstants.MOBILE_PHONE, temp.getString("user_mobelPhone"));
                                    editor.putString(BaseConstants.COMPANY, temp.getString("user_company"));
                                    editor.putString(BaseConstants.ROLE_ID, "4");
                                    editor.putString(BaseConstants.ROLE_NAME, BaseConstants.LoginRole.LING_DAO.getValue());
                                    editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                    editor.putString(BaseConstants.UID, temp.getString("user_id"));
                                } else {
                                    editor.clear();
                                }
                                editor.commit();


                                toMainNengLiangEActivity();
                            }
                            // 施工监理的rolesId为1034,跳转
                            else if (name.equals(BaseConstants.LoginRole.SHI_GONG_JIAN_LI.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                    editor.putString(BaseConstants.USERNAME, temp.getString("user_name"));
                                    editor.putString(BaseConstants.MOBILE_PHONE, temp.getString("user_mobelPhone"));
                                    editor.putString(BaseConstants.COMPANY, temp.getString("user_company"));
                                    editor.putString(BaseConstants.ROLE_ID, "4");
                                    editor.putString(BaseConstants.ROLE_NAME, BaseConstants.LoginRole.LING_DAO.getValue());
                                    editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                    editor.putString(BaseConstants.UID, temp.getString("user_id"));
                                } else {
                                    editor.clear();
                                }
                                editor.commit();


                                Intent intent = new Intent(LoginActivity.this, StoreSGJLCutMidQRC.class);
                                startActivity(intent);
                            }
                            // 工程审计专工的rolesId为1036,跳转
                            else if (name.equals(BaseConstants.LoginRole.GONG_CHENG_SHEN_JI_ZHUAN_GONG.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                    editor.putString(BaseConstants.USERNAME, temp.getString("user_name"));
                                    editor.putString(BaseConstants.MOBILE_PHONE, temp.getString("user_mobelPhone"));
                                    editor.putString(BaseConstants.COMPANY, temp.getString("user_company"));
                                    editor.putString(BaseConstants.ROLE_ID, "4");
                                    editor.putString(BaseConstants.ROLE_NAME, BaseConstants.LoginRole.LING_DAO.getValue());
                                    editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                    editor.putString(BaseConstants.UID, temp.getString("user_id"));
                                } else {
                                    editor.clear();
                                }
                                editor.commit();


                                Intent intent = new Intent(LoginActivity.this, StoreGCSJCutMidQRCActivity.class);
                                startActivity(intent);
                            }
                            // 质量管理员的rolesId为10,跳转
                            else if (name.equals(BaseConstants.LoginRole.ZHI_LIANG_GUAN_LI_YUAN.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                } else {
                                    editor.clear();
                                }
                                editor.commit();


                                Intent intent = new Intent(LoginActivity.this, StoreListMonthked.class);
                                startActivity(intent);
                            }
                            // 质量检验人员的rolesId为1037,跳转
                            else if (name.equals(BaseConstants.LoginRole.ZHI_LIANG_JIA_CHA_ZHUAN_GONG.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                } else {
                                    editor.clear();
                                }
                                editor.commit();


                                Intent intent = new Intent(LoginActivity.this, StoreListMonthkedZLJY.class);
                                startActivity(intent);
                            }
                            // 报废回收专工的rolesId为1038,跳转
                            else if (name.equals(BaseConstants.LoginRole.BAO_FEI_HUI_SHOU_ZHUAN_GONG.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                    editor.putString(BaseConstants.USERNAME, temp.getString("user_name"));
                                    editor.putString(BaseConstants.MOBILE_PHONE, temp.getString("user_mobelPhone"));
                                    editor.putString(BaseConstants.COMPANY, temp.getString("user_company"));
                                    editor.putString(BaseConstants.ROLE_ID, "4");
                                    editor.putString(BaseConstants.ROLE_NAME, BaseConstants.LoginRole.LING_DAO.getValue());
                                    editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                    editor.putString(BaseConstants.UID, temp.getString("user_id"));
                                } else {
                                    editor.clear();
                                }
                                editor.commit();


                                Intent intent = new Intent(LoginActivity.this, StoreListRecoveryActivity.class);
                                startActivity(intent);
                            }
                            //盘点员
                            else if (name.equals(BaseConstants.LoginRole.PAN_DIAN_YUAN.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                    editor.putString(BaseConstants.USERNAME, temp.getString("user_name"));
                                    editor.putString(BaseConstants.MOBILE_PHONE, temp.getString("user_mobelPhone"));
                                    editor.putString(BaseConstants.COMPANY, temp.getString("user_company"));
                                    editor.putString(BaseConstants.ROLE_ID, "4");
                                    editor.putString(BaseConstants.ROLE_NAME, BaseConstants.LoginRole.PAN_DIAN_YUAN.getValue());
                                    editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                    editor.putString(BaseConstants.UID, temp.getString("user_id"));
                                } else {
                                    editor.clear();
                                }
                                editor.commit();
                                Intent intent = new Intent(LoginActivity.this, PanDianActivity.class);
                                startActivity(intent);
                            }
                            //司机
                            else if (name.equals(BaseConstants.LoginRole.SI_JI.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                    editor.putString(BaseConstants.USERNAME, temp.getString("user_name"));
                                    editor.putString(BaseConstants.MOBILE_PHONE, temp.getString("user_mobelPhone"));
                                    editor.putString(BaseConstants.COMPANY, temp.getString("user_company"));
                                    editor.putString(BaseConstants.ROLE_ID, "4");
                                    editor.putString(BaseConstants.ROLE_NAME, BaseConstants.LoginRole.SI_JI.getValue());
                                    editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                    editor.putString(BaseConstants.UID, temp.getString("user_id"));

                                    editor.putString(BaseConstants.DISPLAY_NAME, temp.getString("user_name"));
//                                editor.putString(BaseConstants.MOBILE_PHONE, login.getMobile_phone());
                                } else {
                                    editor.clear();
                                }
                                editor.commit();
//                            Intent intent = new Intent(LoginActivity.this, PanDianActivity.class);
//                            startActivity(intent);
                                Utils.navigation(LoginActivity.this, RouterHub.PEI_SONG_YUN_SHU_CHU_KU_MAIN_ACTIVITY);

                            }
//                        //接收人
//                        else if (name.equals(BaseConstants.LoginRole.JIE_SHOU_REN.getValue())) {
//                            SharedPreferences.Editor editor = user.edit();
//                            if (cb_jzmm.isChecked()) {
//                                editor.putBoolean("user", true);
//                                editor.putString("name1", edtUser.getText().toString());
//                                editor.putString("password1", edtPwd.getText().toString());
//                                editor.putString(BaseConstants.USERNAME, temp.getString("user_name"));
//                                editor.putString(BaseConstants.MOBILE_PHONE, temp.getString("user_mobelPhone"));
//                                editor.putString(BaseConstants.COMPANY, temp.getString("user_company"));
//                                editor.putString(BaseConstants.ROLE_ID, "4");
//                                editor.putString(BaseConstants.ROLE_NAME, BaseConstants.LoginRole.JIE_SHOU_REN.getValue());
//                                editor.putBoolean(BaseConstants.IS_LOGIN, true);
//                                editor.putString(BaseConstants.UID, temp.getString("user_id"));
//
////                                List<LoginReceiver> loginReceiver =mSharedPreferencesHelper.getObjectList("", LoginReceiver.class);
////
//
////                                mSharedPreferencesHelper.putListData("loginReceivers", loginReceiver);
//                            } else {
//                                editor.clear();
//                            }
//                            editor.commit();
////                            Intent intent = new Intent(LoginActivity.this, PanDianActivity.class);
////                            startActivity(intent);
//                            Utils.navigation(LoginActivity.this, RouterHub.PEI_SONG_YUN_SHU_RU_KU_MAIN_ACTIVITY);
//
//                        }
                            // 扫码出库人员的rolesId为999999,跳转
                            else if (y.equals("999999")) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                } else {
                                    editor.clear();
                                }
                                editor.commit();


                                Intent intent = new Intent(LoginActivity.this, StoreListOutStorage.class);
                                startActivity(intent);
                            }
                            // 仓库警报专工的rolesId为1040,跳转
                            else if (name.equals(BaseConstants.LoginRole.CANG_KU_BAO_JING_ZHUAN_GONG.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                } else {
                                    editor.clear();
                                }
                                editor.commit();


                                Intent intent = new Intent(LoginActivity.this, StoreListAlarmOp.class);
                                startActivity(intent);
                            }


                            //取样人员
                            else if (name.equals(BaseConstants.LoginRole.ZHI_JIAN_QU_YANG_YUAN.getValue())) {
//                                SharedPreferences.Editor editor = user.edit();
//                                if (cb_jzmm.isChecked()) {
//                                    editor.putBoolean("user", true);
//                                    editor.putString("name1", edtUser.getText().toString());
//                                    editor.putString("password1", edtPwd.getText().toString());
//                                } else {
//                                    editor.clear();
//                                }
//                                editor.commit();
//                                Log.e("nameqqqqqqqqqqqq===", "iiiiiiiiiiiiiiiiii");
//                                Intent intent = new Intent(LoginActivity.this, ZhiliangQuYangActivity.class);
//                                startActivity(intent);

                                SharedPreferences.Editor editor = user.edit();
                                editor.putBoolean("user", true);
                                editor.putString("name1", edtUser.getText().toString());
                                editor.putString("password1", edtPwd.getText().toString());
                                editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                editor.putString(BaseConstants.USERNAME, temp.getString("user_name"));
                                editor.putString(BaseConstants.MOBILE_PHONE, temp.getString("user_mobelPhone"));
                                editor.putString(BaseConstants.COMPANY, temp.getString("user_company"));

                                editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                editor.putString(BaseConstants.UID, temp.getString("user_id"));
                                String isauto = "";

                                if (temp.has(BaseConstants.IS_AUTO)) {
                                    isauto = temp.getString(BaseConstants.IS_AUTO); //1 代表管理自动仓库 0 代表管理一般仓库
                                    String sid = temp.getString(BaseConstants.SID); //自动仓库的id
                                    editor.putString(BaseConstants.IS_AUTO, isauto);
                                    editor.putString(BaseConstants.SID, sid);
                                    editor.putString(BaseConstants.UID, temp.getString("user_id"));
                                }
                                editor.commit();

                                Intent intent = new Intent(LoginActivity.this, QuYangGongNengXuanZeActivity.class);
                                startActivity(intent);

                            }
                            //封签人员
                            else if (name.equals(BaseConstants.LoginRole.ZHI_JIAN_FENG_QIAN_YUAN.getValue())) {
//                                SharedPreferences.Editor editor = user.edit();
//                                if (cb_jzmm.isChecked()) {
//                                    editor.putBoolean("user", true);
//                                    editor.putString("name1", edtUser.getText().toString());
//                                    editor.putString("password1", edtPwd.getText().toString());
//                                } else {
//                                    editor.clear();
//                                }
//                                editor.commit();
//
//                                Intent intent = new Intent(LoginActivity.this, FengqianActivity.class);
//                                startActivity(intent);
                                SharedPreferences.Editor editor = user.edit();
                                editor.putBoolean("user", true);
                                editor.putString("name1", edtUser.getText().toString());
                                editor.putString("password1", edtPwd.getText().toString());
                                editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                editor.putString(BaseConstants.USERNAME, temp.getString("user_name"));
                                editor.putString(BaseConstants.MOBILE_PHONE, temp.getString("user_mobelPhone"));
                                editor.putString(BaseConstants.COMPANY, temp.getString("user_company"));

                                editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                editor.putString(BaseConstants.UID, temp.getString("user_id"));
                                String isauto = "";

                                if (temp.has(BaseConstants.IS_AUTO)) {
                                    isauto = temp.getString(BaseConstants.IS_AUTO); //1 代表管理自动仓库 0 代表管理一般仓库
                                    String sid = temp.getString(BaseConstants.SID); //自动仓库的id
                                    editor.putString(BaseConstants.IS_AUTO, isauto);
                                    editor.putString(BaseConstants.SID, sid);
                                    editor.putString(BaseConstants.UID, temp.getString("user_id"));
                                }
                                editor.commit();

                                Intent intent = new Intent(LoginActivity.this, FengQianLieBiaoActivity.class);
                                startActivity(intent);
                            }
                            //质量收样员
                            else if (name.equals(BaseConstants.LoginRole.ZHI_JIAN_SHOU_YANG_YUAN.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                } else {
                                    editor.clear();
                                }
                                editor.commit();

                                Intent intent = new Intent(LoginActivity.this, ZhiliangshouyangActivity.class);
                                startActivity(intent);
                            }
                            //检验人员
                            else if (name.equals(BaseConstants.LoginRole.ZHI_JIAN_JIAN_CE_YUAN.getValue())) {
//                                SharedPreferences.Editor editor = user.edit();
//                                if (cb_jzmm.isChecked()) {
//                                    editor.putBoolean("user", true);
//                                    editor.putString("name1", edtUser.getText().toString());
//                                    editor.putString("password1", edtPwd.getText().toString());
//                                } else {
//                                    editor.clear();
//                                }
//                                editor.commit();
//
//                                Intent intent = new Intent(LoginActivity.this, JianyanActivity.class);
//                                startActivity(intent);

                                SharedPreferences.Editor editor = user.edit();
                                editor.putBoolean("user", true);
                                editor.putString("name1", edtUser.getText().toString());
                                editor.putString("password1", edtPwd.getText().toString());
                                editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                editor.putString(BaseConstants.USERNAME, temp.getString("user_name"));
                                editor.putString(BaseConstants.MOBILE_PHONE, temp.getString("user_mobelPhone"));
                                editor.putString(BaseConstants.COMPANY, temp.getString("user_company"));

                                editor.putBoolean(BaseConstants.IS_LOGIN, true);
                                editor.putString(BaseConstants.UID, temp.getString("user_id"));
                                String isauto = "";

                                if (temp.has(BaseConstants.IS_AUTO)) {
                                    isauto = temp.getString(BaseConstants.IS_AUTO); //1 代表管理自动仓库 0 代表管理一般仓库
                                    String sid = temp.getString(BaseConstants.SID); //自动仓库的id
                                    editor.putString(BaseConstants.IS_AUTO, isauto);
                                    editor.putString(BaseConstants.SID, sid);
                                    editor.putString(BaseConstants.UID, temp.getString("user_id"));
                                }
                                editor.commit();

                                Intent intent = new Intent(LoginActivity.this, JianCeYuanGongNengXuanZeActivity.class);
                                startActivity(intent);
                            }
                            //取样封签员

                            else if (name.equals(BaseConstants.LoginRole.QU_YANG_FENG_QIAN_YUAN.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("iduser", temp.getString("user_id"));
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                } else {
                                    editor.clear();
                                }
                                editor.commit();

                                Intent intent = new Intent(LoginActivity.this, QuyangFengqianyuanActivity.class);
                                startActivity(intent);
                            }
                            //分配班长
                            else if (name.equals(BaseConstants.LoginRole.PEI_SONG_BAN_ZHANG.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                } else {
                                    editor.clear();
                                }
                                editor.commit();
                                Log.e("nameqqqqqqqqqqqq===", "iiiiiiiiiiiiiiiiii");
                                Intent intent = new Intent(LoginActivity.this, ShenQingPeisongActivity.class);
                                startActivity(intent);
                            }

                            //分配管理员
                            else if (name.equals(BaseConstants.LoginRole.PEI_SONG_GUAN_LI_YUAN.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                } else {
                                    editor.clear();
                                }
                                editor.commit();
                                Log.e("nameqqqqqqqqqqqq===", "iiiiiiiiiiiiiiiiii");
                                Intent intent = new Intent(LoginActivity.this, LingdaoShenPiActivity.class);
                                startActivity(intent);
                            }

                            // 仓库门禁专工的rolesId为1041,跳转
                            else if (name.equals(BaseConstants.LoginRole.CANG_KU_MEN_JIN_ZHUAN_GONG.getValue())) {
                                SharedPreferences.Editor editor = user.edit();
                                if (cb_jzmm.isChecked()) {
                                    editor.putBoolean("user", true);
                                    editor.putString("name1", edtUser.getText().toString());
                                    editor.putString("password1", edtPwd.getText().toString());
                                } else {
                                    editor.clear();
                                }
                                editor.commit();


                                Intent intent = new Intent(LoginActivity.this, StoreListDoorCloseOp.class);
                                startActivity(intent);
                            } else {
                                ArmsUtils.makeText(LoginActivity.this, "对不起,您没有权限登录");
                            }
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                } else {
                    ArmsUtils.makeText(LoginActivity.this, "用户名或密码错误");
                    return;
                }

            }

            @Override
            public void onFailure(int statusCode, String content, Throwable error) {
                hideLoading();

                ArmsUtils.makeText(LoginActivity.this, "登录异常，请联系相关负责人");

            }

            @Override
            public void onFailure(int statusCode, SoapFault fault) {
                hideLoading();
                ArmsUtils.makeText(LoginActivity.this, "登录异常，请联系相关负责人");
            }
        });

    }

    public void showLoading() {
        CProgressDialogUtils.showProgressDialog(this, "登录中...");
    }

    public void hideLoading() {
        CProgressDialogUtils.cancelProgressDialog(this);
    }

    /**
     * 跳转到新版的主页
     */
    private void toMainNengLiangEActivity() {
        Intent intent = new Intent(LoginActivity.this, MainNengLiangEActivity.class);
        startActivity(intent);
        ArmsUtils.makeText(LoginActivity.this, "登录成功");
//        finish();
    }

    @Override
    public void onPermissionsGranted(int requestCode, @NonNull List<String> perms) {

        ArmsUtils.makeText(this, "相关权限获取成功");
    }

    @Override
    public void onPermissionsDenied(int requestCode, @NonNull List<String> perms) {
        ArmsUtils.makeText(this, "请同意相关权限，否则功能无法使用");

    }

    /**
     * 自定义接口协议
     *
     * @param view http://dezhou.xywuhe.com:6699/StoreService.asmx
     */
    public void updateDiy(View view) {

//        String path = Environment.getExternalStorageDirectory().getAbsolutePath();

        Map<String, String> params = new HashMap<String, String>();

        params.put("appKey", "ab55ce55Ac4bcP408cPb8c1Aaeac179c5f6f");
        params.put("appVersion", AppUpdateUtils.getVersionName(this));
        params.put("key1", "value2");
        params.put("key2", "value3");


        new UpdateAppManager
                .Builder()
                //必须设置，当前Activity
                .setActivity(this)
                //必须设置，实现httpManager接口的对象
                .setHttpManager(new UpdateAppHttpUtil())
                //必须设置，更新地址
                .setUpdateUrl("http://dezhou.xywuhe.com:6699/storeservice.asmx/getVersionUpdateInfo")
                //全局异常捕获
                .handleException(new ExceptionHandler() {
                    @Override
                    public void onException(Exception e) {
                        e.printStackTrace();
                    }
                })
                //以下设置，都是可选
                //设置请求方式，默认get
                .setPost(true)
                //不显示通知栏进度条
//                .dismissNotificationProgress()
                //是否忽略版本
//                .showIgnoreVersion()
                //添加自定义参数，默认version=1.0.0（app的versionName）；apkKey=唯一表示（在AndroidManifest.xml配置）
                .setParams(params)
                //设置点击升级后，消失对话框，默认点击升级后，对话框显示下载进度，如果是强制更新，则设置无效
//                .hideDialogOnDownloading()
                //设置头部，不设置显示默认的图片，设置图片后自动识别主色调，然后为按钮，进度条设置颜色
                .setTopPic(R.drawable.top_8)
                //为按钮，进度条设置颜色。
                .setThemeColor(0xffffac5d)
                //设置apk下砸路径，默认是在下载到sd卡下/Download/1.0.0/test.apk
//                .setTargetPath(path)
                //设置appKey，默认从AndroidManifest.xml获取，如果，使用自定义参数，则此项无效
//                .setAppKey("ab55ce55Ac4bcP408cPb8c1Aaeac179c5f6f")
                .setUpdateDialogFragmentListener(new IUpdateDialogFragmentListener() {
                    @Override
                    public void onUpdateNotifyDialogCancel(UpdateAppBean updateApp) {
                        //用户点击关闭按钮，取消了更新，如果是下载完，用户取消了安装，则可以在 onActivityResult 监听到。

                    }
                })
                //不自动，获取
//                .setIgnoreDefParams(true)
                .build()
                //检测是否有新版本
                .checkNewApp(new UpdateCallback() {
                    /**
                     * 解析json,自定义协议
                     *
                     * @param json 服务器返回的json
                     * @return UpdateAppBean
                     */
                    @Override
                    protected UpdateAppBean parseJson(String json) {
                        UpdateMyAppBean updateAppBean = new UpdateMyAppBean();
                        try {
                            String result = json.substring(75, json.toCharArray().length - 9);
                            if (result.equals("[]")) {
                            } else {
                                JSONObject jsonObject = new JSONObject(result);
                                String code = jsonObject.optString("code");

                                if (Integer.parseInt(code) > DeviceUtils.getVersionCode(LoginActivity.this)) {


                                    final String newVersion = jsonObject.optString("new_version");
                                    updateAppBean
                                            //（必须）是否更新Yes,No
                                            .setUpdate(jsonObject.optString("update"))
                                            //（必须）新版本号，
                                            .setNewVersion(newVersion)
                                            //（必须）下载地址
                                            .setApkFileUrl(jsonObject.optString("apk_file_url"))
                                            //测试下载路径是重定向路径
//                                    .setApkFileUrl("http://openbox.mobilem.360.cn/index/d/sid/3282847")
//                                    .setUpdateDefDialogTitle(String.format("AppUpdate 是否升级到%s版本？", newVersion))
                                            //（必须）更新内容
                                            .setUpdateLog(jsonObject.optString("update_log"))
                                            //测试内容过度
//                                    .setUpdateLog("测试")
//                                    .setUpdateLog("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16")
//                                            .setUpdateLog("今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说相对于其他行业来说今天我们来聊一聊程序员枯燥的编程生活，相对于其他行业来说\r\n")
                                            //大小，不设置不显示大小，可以不设置
                                            .setTargetSize(jsonObject.optString("target_size"))
                                            //是否强制更新，可以不设置
                                            .setConstraint(true)
                                            //设置md5，可以不设置
                                            .setNewMd5(jsonObject.optString("new_md5"));
                                } else {
//                                    ArmsUtils.makeText(LoginActivity.this, "没有新版本");
                                }
                            }


                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                        return updateAppBean;
                    }

                    @Override
                    protected void hasNewApp(UpdateAppBean updateApp, UpdateAppManager updateAppManager) {
                        updateAppManager.showDialogFragment();
                    }

                    /**
                     * 网路请求之后
                     */
                    @Override
                    public void onAfter() {
                        CProgressDialogUtils.cancelProgressDialog(LoginActivity.this);
                    }

                    /**
                     * 没有新版本
                     */
                    @Override
                    public void noNewApp(String error) {
                        Toast.makeText(LoginActivity.this, "没有新版本", Toast.LENGTH_SHORT).show();
                    }

                    /**
                     * 网络请求之前
                     */
                    @Override
                    public void onBefore() {
                        CProgressDialogUtils.showProgressDialog(LoginActivity.this);
                    }
                });

    }

    private void getVersionUpdateInfo() {


        String methodName = "getVersionUpdateInfo";

        SoapUtil soapUtil = SoapUtil.getInstance(this);
        soapUtil.setDotNet(true);
        SoapParams params = new SoapParams();
//        params.put("phone", getUsername());
//        params.put("loginPwd", getPassword());

        /**
         * 请求
         */
        soapUtil.call(getUrl(), NAME_SPACE, methodName, params, new SoapListener() {
            @Override
            public void onSuccess(int statusCode, SoapObject object) {

                String result = object.getProperty("getVersionUpdateInfoResult").toString();
                if (result != null && !result.equals("[]")) {


                } else {

                }

            }

            @Override
            public void onFailure(int statusCode, String content, Throwable error) {
            }

            @Override
            public void onFailure(int statusCode, SoapFault fault) {
            }
        });


    }

    /**
     * 强制更新
     *
     * @param view
     */
    public void constraintUpdate(View view) {
        new UpdateAppManager
                .Builder()
                //当前Activity
                .setActivity(this)
                //更新地址
                .setUpdateUrl(mUpdateUrl)
                //实现httpManager接口的对象
                .setHttpManager(new UpdateAppHttpUtil())
                .build()
                .update();
    }

}
